<?php
/**
 * 描述
 * Created by Paco
 * Date: 2018/10/5 Time: 11:31
 */

namespace App\Lib\Elasticsearch;


class BankProducts
{
    private $es;

    public function __construct()
    {
        $this->es = new Elasticsearch('bank_index');
    }

    public function index($pro)
    {
        $query = [
            'id' => $pro->product_id,
        ];

        $body = [
            'product_id' => $pro->product_id,
            'logo' => $pro->logo,
            'product_type' => $pro->product_type,
            'service_type' => $pro->service_type,
            'min_deposit' => $pro->min_deposit,
            'max_deposit' =>$pro->max_deposit,
            'min_time_limit' =>$pro->min_time_limit,
            'max_time_limit' =>$pro->max_time_limit,
            'mortgage_type' => $pro->mortgage_type,
            'loan_time' => $pro->loan_time,
            'title' => $pro->title,
            'city' => $pro->city,
        ];

        return $this->es->index($body, $query);
    }


}